package org.zbclan.bf2.rcon.home.client.json;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.core.client.JsArray;

public class InfoJson extends JavaScriptObject {

	public static native InfoJson fromString(String desc) /*-{
		return eval("(" + desc + ")");
	}-*/;

	protected InfoJson() {
	}

	public final native Map getMap()/*-{
		return this["map"];
	}-*/;

	public static class Map extends JavaScriptObject {

		protected Map() {
		}

		public final native String getGsid()/*-{
			return this["gsid"];
		}-*/;

		public final native String getName()/*-{
			return this["name"];
		}-*/;

		public final native JsArray<Mode> getModes()/*-{
			return this["modes"];
		}-*/;
	}

	public static class Mode extends JavaScriptObject {

		protected Mode() {
		}

		public final native String getMode()/*-{
			return this["mode"];
		}-*/;

		public final native JsArray<MapType> getMapTypes()/*-{
			return this["maptypes"];
		}-*/;
	}

	public static class MapType extends JavaScriptObject {

		protected MapType() {
		}

		public final native String getPlayers()/*-{
			return this["players"];
		}-*/;

		public final native int getType()/*-{
			return this["type"];
		}-*/;
	}

}
